package optimization;

import static optimization.LinearAlgebra.*;

public class NelderMeadS9RS extends NelderMead {

	public NelderMeadS9RS(StochasticFunction f, VectorFunction cons, double dxTerminationLimit) 
	{
		super(f, cons, dxTerminationLimit);
	}

	// S9
	@Override
	protected double getDelta() {
//		System.out.println(":: S9 ::");
		return 0.9;
	}
	
	// RS
	@Override
	protected boolean shrink()
	{
		boolean r = super.shrink();
		
		// RS Modification
		double fs0 = f.evaluate(points.get(0).x, N, System.currentTimeMillis());
		System.out.println(":: RS :: " + points.get(0).fx + " -> " + fs0);
		points.get(0).fx = fs0;
		return r;		
	}	
}
